<template>
  <div class="app-page">
    <!-- 头 -->
    <div class="app-header">
      <div class="app-title">
        <i :class="$route.meta.icon"></i> {{ $route.meta.title }}
      </div>
    </div>
    <div class="app-page-padding">
      <div class="app-section">
        <ul class="rs-background-clip">
          <li class="border-box">
            <h2>border-box</h2>
            <p>从border区域（不含border）开始向外裁剪背景</p>
          </li>
          <li class="padding-box">
            <h2>padding-box</h2>
            <p>从padding区域（不含padding）开始向外裁剪背景</p>
          </li>
          <li class="content-box">
            <h2>content-box</h2>
            <p>从content区域开始向外裁剪背景</p>
          </li>
          <li class="text">
            <h2>text</h2>
            <p>从前景内容的形状作为裁剪区域向外裁剪背景</p>
          </li>
        </ul>
      </div>
      <div class="app-section">
        <!-- bidirectional data binding（双向数据绑定） -->
        <codemirror v-model="code" :options="cmOptions"></codemirror>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'StyleButton',
  data () {
    return {
      code: `
// 背景裁剪
.rs-background-clip {
  .border-box p {
    background-clip: border-box;
  }
  .padding-box p {
    background-clip: padding-box;
  }
  .content-box p {
    background-clip: content-box;
  }
  .text p {
    width: auto;
    height: auto;
    background-repeat: repeat;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: bold;
    font-size: 120px;
  }
}
      `,
      cmOptions: {
        // codemirror options
        tabSize: 4,
        mode: 'sass',
        theme: 'darcula',
        lineNumbers: true,
        line: true
        // more codemirror options, 更多 codemirror 的高级配置...
      }
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
h1 {
  font-size: 20px;
}
h2 {
  font-size: 16px;
}
p {
  width: 200px;
  height: 200px;
  margin: 0;
  padding: 20px;
  border: 10px dashed #666;
  // background: #aaa url(images/bg02.jpg) no-repeat;
  background: #aaa url("~@/assets/bg02.jpg") no-repeat center center;
}
// 背景裁剪
.rs-background-clip {
  .border-box p {
    background-clip: border-box;
  }
  .padding-box p {
    background-clip: padding-box;
  }
  .content-box p {
    background-clip: content-box;
  }
  .text p {
    width: auto;
    height: auto;
    background-repeat: repeat;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: bold;
    font-size: 120px;
  }
}
</style>
